<?php
class Application_Model_User {
	protected $_id;

	public function id() {
		return $this->_id;
	}

	public function set_id($id) {
		$this->_id = $id;
	}

	protected $_login;

	public function login() {
		return $this->_login;
	}

	public function set_login($login) {
		$this->_login = $login;
	}

	protected $_hashedPassword;

	public function hashedPassword() {
		return $this->_hashedPassword;
	}

	public function set_hashedPassword($hashedPassword) {
		$this->_hashedPassword = $hashedPassword;
	}

	protected $_email;

	public function email() {
		return $this->_email;
	}

	public function set_email($email) {
		$this->_email = $email;
	}

	protected $_activated;

	public function activated() {
		return $this->_activated;
	}

	public function set_activated($activated) {
		$this->_activated = $activated;
	}

	protected $_level;

	public function level() {
		return $this->_level;
	}

	public function set_level($level) {
		$this->_level = $level;
	}

	protected $_banned;

	public function banned() {
		return $this->_banned;
	}

	public function set_banned($banned) {
		$this->_banned = $banned;
	}

    public function isAdmin() {
        return $this->activated() && !$this->banned() &&
                ($this->level() == 'admin' || $this->level() == 'superadmin');
    }

    public function isSuperAdmin() {
        return $this->activated() && !$this->banned() && $this->level() == 'superadmin';
    }

	function __construct($id,$login,$hashedPassword,$email,$activated,$level,$banned) {
		$this->_id = $id;
		$this->_login = $login;
		$this->_hashedPassword = $hashedPassword;
		$this->_email = $email;
		$this->_activated = $activated;
		$this->_level = $level;
		$this->_banned = $banned;
	}
}
